// 上传文件
function PostUploadFile(fileItem, projectId) {
  const url = '/api/file/upload'

  const form = new FormData()
  form.append('file', fileItem)
  form.append('projectId', projectId)
  return axios.post(
    url,
    form,
  ).then(res => {
    if (res.data.code !== 200) {
      throw new Error(res.data.message)
    } else {
      return res.data.data
    }
  })
}
function PostUploadJSON(jsonString) {
  const url = '/api/upload/json'
  return axios.post(
    url,
    {
      content: jsonString,
    },
  ).then(res => {
    if (res.data.code !== 200) {
      throw new Error(res.data.message)
    } else {
      return res.data.data
    }
  })
}
